﻿using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Merge
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        string file1 = "";
        string file2 = "";

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Multiselect = true;
            dialog.Title = "请选择文件夹";
            if (dialog.ShowDialog() == true)
            {
                string file = dialog.FileName;
                file1 = file;
                Console.WriteLine(file);
                File1.Content = file1;
            }
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Multiselect = true;
            dialog.Title = "请选择文件夹";
            if (dialog.ShowDialog() == true)
            {
                string file = dialog.FileName;
                file2 = file;
                Console.WriteLine(file);
                File2.Content = file2;
            }
        }

        private void Merge(object sender, RoutedEventArgs e)
        {
            if (file1 != "" && file2 != "")
            {
                string F1 = System.IO.File.ReadAllText(file1);
                string F2 = System.IO.File.ReadAllText(file2);
                string M = F1 + F2;
                System.IO.File.WriteAllText("../../../Merge.txt",M); // 项目文件目录下
            }
        }
    }
}
